﻿using System;
using System.Activities;
using System.Activities.Expressions;
using System.Activities.Presentation.PropertyEditing;
using System.Activities.Statements;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Management.Automation;
using System.Windows.Markup;

namespace Vision.Core.ActivityComponents.Common
{
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="TResult"></typeparam>
    public class CastObjectAs<T> : CodeActivity
    {        
        /// <summary>
        /// 
        /// </summary>
        public InArgument<object> In { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public OutArgument<T> Out { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        protected override void Execute(CodeActivityContext context)
        {
            this.Out.Set(context, (T)context.GetValue(this.In));                
        }
    }
}
